package com.seari.service.Impl;

import com.seari.bean.FaultWarningResponseBean;
import com.seari.mapper.FaultMapper;
import com.seari.pojo.FaultData;
import com.seari.service.FaultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FaultServiceImpl implements FaultService {
    @Autowired
    private FaultMapper faultMapper;
    @Override
    public List<FaultData> getIdGroupStatu() {
        return faultMapper.getIdGroupStatu();
    }

    @Override
    public int updFaultStatu(String faultId) {
        if (faultId == null||faultId.equals("")) {
            return -1;
        }
        return faultMapper.updFaultStatu(faultId);
    }

    /**
     * 根据线路id查询故障应急警报列表
     * @param lineId
     * @return
     */
    @Override
    public List<FaultWarningResponseBean> queryFaultWarningList(String lineId,String faultLocation ,String currentPage,String pageSize) {
        Integer startIndex = (Integer.valueOf(currentPage) - 1) * Integer.valueOf(pageSize);
        return faultMapper.queryFaultWarningList(lineId,faultLocation,startIndex.toString(),pageSize);
    }

    /**
     * 查询故障应急警报已完成数
     * @param lineId
     * @return
     */
    @Override
    public String faultWarningCompleteCount(String lineId,String faultLocation) {
        return faultMapper.faultWarningCompleteCount(lineId,faultLocation);
    }

	@Override
	public int addFaultPoint(FaultData fd) {
		// TODO Auto-generated method stub
		return faultMapper.addFaultPoint(fd);
	}
}
